<!-- 数字制造-->
<template>
	<view class="content">
		<view class="swiper">
			<swiper class="swiper" indicator-dots="true" autoplay="true" interval="3000" duration="500">
				<swiper-item>
					<image class="swiper-item" src="../../static/hp_banner-1.png"/>
				</swiper-item>
				<swiper-item>
					<image class="swiper-item" src="../../static/hp_banner-4.png"/>
				</swiper-item>
				<swiper-item>
					<image class="swiper-item" src="../../static/hp_banner-3.png"/>
				</swiper-item>
			</swiper>
		</view>
		<view class="bottom-view" v-if="listData.list2.length>0">
			<view class="bottom-view-top">
				<view style="width: 28upx;"></view>
				<view style="height: 26upx;width: 5upx;background-color: #4A86C6;"></view>
				<view class="bottom-view-top-view">
					<view>{{inter.sbgl}}</view>
				</view>
			</view>
			<view class="bottom-view-bot-v" >
				<view class="bottom-view-bot-v-view" v-for="(value, index) in listData.list2" :key="index" @click="navigateToFun1(value.ID)">
					<image :src="value.src" style="width: 64upx;height: 64upx;"  mode="aspectFit"  ></image>
					<text style="font-size: 26upx;color: #2F2F2F;margin-top: 12upx;">{{value.name}}</text>
				</view>
			</view>
		</view>
		<view class="bottom-view" v-if="listData.list1.length>0">
			<view class="bottom-view-top">
				<view style="width: 28upx;"></view>
				<view style="height: 26upx;width: 5upx;background-color: #4A86C6;"></view>
				<view class="bottom-view-top-view">
					<view>{{inter.zlqxgl}}</view>
				</view>
			</view>
			<view class="bottom-view-bot-v" >
				<view class="bottom-view-bot-v-view" v-for="(value, index) in listData.list1" :key="index" @click="navigateToFun2(value.ID)">
					<image :src="value.src" style="width: 64upx;height: 64upx;"  mode="aspectFit"  ></image>
					<text style="font-size: 26upx;color: #2F2F2F;margin-top: 12upx;">{{value.name}}</text>
				</view>
			</view>
		</view>
		<view class="bottom-view" v-if="listData.list3.length>0">
			<view class="bottom-view-top">
				<view style="width: 28upx;"></view>
				<view style="height: 26upx;width: 5upx;background-color: #4A86C6;"></view>
				<view class="bottom-view-top-view">
					<view>{{inter.trccgl}}</view>
				</view>
			</view>
			<view class="bottom-view-bot-v" >
				<view class="bottom-view-bot-v-view" v-for="(value, index) in listData.list3" :key="index" @click="navigateToFun3(value.ID)">
					<image :src="value.src" style="width: 64upx;height: 64upx;"  mode="aspectFit"  ></image>
					<text style="font-size: 26upx;color: #2F2F2F;margin-top: 12upx;">{{value.name}}</text>
				</view>
			</view>
		</view>
		<view class="bottom-view" v-if="listData.list4.length>0">
			<view class="bottom-view-top">
				<view style="width: 28upx;"></view>
				<view style="height: 26upx;width: 5upx;background-color: #4A86C6;"></view>
				<view class="bottom-view-top-view">
					<view>{{inter.zzpgl}}</view>
				</view>
			</view>
			<view class="bottom-view-bot-v" >
				<view class="bottom-view-bot-v-view" v-for="(value, index) in listData.list4" :key="index" @click="navigateToFun4(value.ID)">
					<image :src="value.src" style="width: 64upx;height: 64upx;"  mode="aspectFit"  ></image>
					<text style="font-size: 26upx;color: #2F2F2F;margin-top: 12upx;">{{value.name}}</text>
				</view>
			</view>
		</view>
		<view class="bottom-view" v-if="listData.list5.length>0">
			<view class="bottom-view-top">
				<view style="width: 28upx;"></view>
				<view style="height: 26upx;width: 5upx;background-color: #4A86C6;"></view>
				<view class="bottom-view-top-view">
					<view>{{inter.tjtb}}</view>
				</view>
			</view>
			<view class="bottom-view-bot-v" >
				<view class="bottom-view-bot-v-view-1" v-for="(value, index) in listData.list5" :key="index" @click="navigateToFun5(value.ID)">
					<text v-if="value.ID==1 || value.ID==3 || value.ID==4 || value.ID==5 || value.ID==6 || value.ID==8 || value.ID==9 || value.ID==11 || value.ID==13 || value.ID==14 " style="font-size: 26upx;color: #2F2F2F;">{{value.name}}</text>
					<text v-if="value.ID==2 || value.ID==7 || value.ID==10 || value.ID==12" style="font-size: 26upx;color: #0C9CDC;">{{value.name}}*</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $api from '@/api/api.js'
	import $inter from '@/api/international.js'
	export default {
		components:{
			
		},
		data() {
			return {
				
				languageValue:'',
				internatinal:'',
				listData:{
					list2:[],
					list1:[],
					list3:[],
					list4:[],
					list5:[],
					bootomArr1 : ['1','3','4','5','6','8','9','11','13','14'],
					bootomArr2 : ['2','7','10','12'],
					thermalProduct:'', 
					thermalReachYield:'', 
					machineProduct:'',
					machineReachYield:'',
					coatingProduct:'',
					coatingReachYield:''
				}
			}
		},
		onLoad(){
			uni.getStorage({
				key:'languageValue',
				success:(res)=>{
					this.languageValue = res.data
				}
			})
			uni.setNavigationBarTitle({
				title: this.inter.szzz
			});
			this.authorityModel()
			this.thermalProduct = uni.getStorageSync('indexData').thermalProduct
			this.thermalReachYield = uni.getStorageSync('indexData').thermalReachYield
			this.machineProduct = uni.getStorageSync('indexData').machineProduct
			this.machineReachYield = uni.getStorageSync('indexData').machineReachYield
			this.coatingProduct = uni.getStorageSync('indexData').coatingProduct
			this.coatingReachYield = uni.getStorageSync('indexData').coatingReachYield
		},
		methods: {
			authorityModel(){
				let authorityData = JSON.parse(uni.getStorageSync('userInfo').AppMenu)
// 				let authorityData = [{"gid":"2","bid":"1"},{"gid":"2","bid":"2"},{"gid":"2","bid":"3"},{"gid":"2","bid":"4"},{"gid":"2","bid":"5"},{"gid":"2","bid":"6"},{"gid":"2","bid":"7"},{"gid":"2","bid":"8"},{"gid":"3","bid":"1"},{"gid":"3","bid":"2"},{"gid":"3","bid":"3"},{"gid":"3","bid":"4"},{"gid":"3","bid":"5"},{"gid":"3","bid":"6"},{"gid":"4","bid":"1"},{"gid":"4","bid":"2"},{"gid":"4","bid":"3"},{"gid":"4","bid":"4"},{"gid":"4","bid":"5"},{"gid":"5","bid":"1"},
// {"gid":"6","bid":"1"},{"gid":"6","bid":"2"},{"gid":"6","bid":"3"},{"gid":"6","bid":"4"},{"gid":"6","bid":"5"},{"gid":"6","bid":"6"},
// {"gid":"6","bid":"7"},{"gid":"6","bid":"8"},{"gid":"6","bid":"9"},{"gid":"6","bid":"10"},{"gid":"6","bid":"11"},{"gid":"6","bid":"12"},
// {"gid":"6","bid":"13"},{"gid":"6","bid":"14"}]
				for (let i in authorityData) {
					if (authorityData[i].gid==='2') {
						switch (authorityData[i].bid){
							case '1':
							// console.log("212121212121212"+this.inter);
								this.listData.list2.push({ID:1,name:this.inter.djgd,src:'../../static/hp_dj_icon.png'})
								break;
							case '2':
								this.listData.list2.push({ID:2,name:this.inter.rhgd,src:'../../static/hp_rh_icon.png'})
								break;
							case '3':
								this.listData.list2.push({ID:3,name:this.inter.bygd,src:'../../static/hp_by_icon.png'})
								break;
							case '4':
								this.listData.list2.push({ID:4,name:this.inter.jxgd,src:'../../static/hp_jx_icon.png'})
								break;
							case '5':
								this.listData.list2.push({ID:5,name:this.inter.gzgd,src:'../../static/hp_gz_icon.png'})
								break;
							case '6':
								this.listData.list2.push({ID:6,name:this.inter.gzfp,src:'../../static/hp_gzfp_icon.png'})
								break;
							case '7':
								this.listData.list2.push({ID:7,name:this.inter.gdwcl,src:'../../static/gdwcl.png'})
								break;
							case '8':
								this.listData.list2.push({ID:8,name:this.inter.gdzxl,src:'../../static/gdzxl.png'})
								break;
							default:
								break;
						}
					
					} 
					else if (authorityData[i].gid==='3'){
						switch (authorityData[i].bid){
							case '1':
								this.listData.list1.push({ID:1,name:this.inter.yzqx,src:'../../static/hp_qx_yz_icon.png'})
								break;
							case '2':
								this.listData.list1.push({ID:2,name:this.inter.rclqx,src:'../../static/hp_qx_rcl_icon.png'})
								break;
							case '3':
								this.listData.list1.push({ID:3,name:this.inter.jjqx,src:'../../static/hp_qx_jj_icon.png'})
								break;
							case '4':
								this.listData.list1.push({ID:4,name:this.inter.zjxxqx,src:'../../static/hp_qx_zjxx_icon.png'})
								break;
							case '5':
								this.listData.list1.push({ID:5,name:this.inter.jcqx,src:'../../static/hp_qx_jc_icon.png'})
								break;
							case '6':
								this.listData.list1.push({ID:6,name:this.inter.fxqx,src:'../../static/hp_qx_fx_icon.png'})
								break;
							default:
								break;
						}
					}
					else if (authorityData[i].gid==='4'){
						switch (authorityData[i].bid){
							case '1':
								this.listData.list3.push({ID:1,name:this.inter.yzcl,src:'../../static/scgl_trcc_yz_icon.png'})
								break;
							case '2':
								this.listData.list3.push({ID:2,name:this.inter.kmjtgl,src:'../../static/scgl_trcc_kmj_icon.png'})
								break;
							case '3':
								this.listData.list3.push({ID:3,name:this.inter.sytrl,src:'../../static/scgl_trcc_xy_icon.png'})
								break;
							case '4':
								this.listData.list3.push({ID:4,name:this.inter.cctrl,src:'../../static/scgl_trcc_cc_icon.png'})
								break;
							case '5':
								this.listData.list3.push({ID:5,name:this.inter.tzsxl,src:'../../static/scgl_trcc_tzsx_icon.png'})
								break;
							default:
								break;
						}
					}
					else if (authorityData[i].gid==='5'){
						switch (authorityData[i].bid){
							case '1':
								this.listData.list4.push({ID:1,name:this.inter.zzphzcx,src:'../../static/zzp_icon.png'})
								break;
							default:
								break;
						}
					}
					else if (authorityData[i].gid==='6'){
						switch (authorityData[i].bid){
							case '1':
								this.listData.list5.push({ID:1,name:this.inter.trlzcx,src:'../../static/hp_qx_yz_icon.png'})
								break;
							case '2':
								this.listData.list5.push({ID:2,name:this.inter.rgccp,src:'../../static/hp_qx_rcl_icon.png'})
								break;
							case '3':
								this.listData.list5.push({ID:3,name:this.inter.rgcpl,src:'../../static/hp_qx_jj_icon.png'})
								break;
							case '4':
								this.listData.list5.push({ID:4,name:this.inter.mjcl,src:'../../static/hp_qx_zjxx_icon.png'})
								break;
// 							case '5':
// 								this.listData.list5.push({ID:5,name:'压铸废品分析',src:'../../static/hp_qx_jc_icon.png'})
// 								break;
							case '5':
								this.listData.list5.push({ID:5,name:this.inter.xgtj,src:'../../static/hp_qx_fx_icon.png'})
								break;
							case '6':
								this.listData.list5.push({ID:6,name:this.inter.jjcpl,src:'../../static/hp_qx_yz_icon.png'})
								break;
							case '7':
								this.listData.list5.push({ID:7,name:this.inter.jjccp,src:'../../static/hp_qx_rcl_icon.png'})
								break;
							case '8':
								this.listData.list5.push({ID:8,name:this.inter.jcccp,src:'../../static/hp_qx_jj_icon.png'})
								break;
							case '9':
								this.listData.list5.push({ID:9,name:this.inter.jccpl,src:'../../static/hp_qx_zjxx_icon.png'})
								break;
							case '10':
								this.listData.list5.push({ID:10,name:this.inter.tzccp,src:'../../static/hp_qx_jc_icon.png'})
								break;
							case '11':
								this.listData.list5.push({ID:11,name:this.inter.tzcpl,src:'../../static/hp_qx_fx_icon.png'})
								break;
							case '12':
								this.listData.list5.push({ID:12,name:this.inter.tzbcp,src:'../../static/hp_qx_zjxx_icon.png'})
								break;
							case '13':
								this.listData.list5.push({ID:13,name:this.inter.tzbcpcpl,src:'../../static/hp_qx_jc_icon.png'})
								break;
							case '14':
								this.listData.list5.push({ID:14,name:this.inter.bhgtj,src:'../../static/hp_qx_fx_icon.png'})
								break;
							default:
								break;
						}
					}
				}
				
			},
			navigateToFun1(e){
				switch (e){
					case 1:
						$api.idSetter('PMTypeCode','D')
						uni.navigateTo({
							url:'./checkTick/checkTick'
						});
						break;
					case 2:
						$api.idSetter('PMTypeCode','R')
						uni.navigateTo({
							url:'./checkTick/checkTick'
						});
						break;
					case 3:
						$api.idSetter('PMTypeCode','B')
						uni.navigateTo({
							url:'./checkTick/checkTick'
						});
						break;
					case 4:
						$api.idSetter('PMTypeCode','J')
						uni.navigateTo({
							url:'./checkTick/checkTick'
						});
						break;
					case 5:
						uni.navigateTo({
							url:'./faultTick/faultTick'
						});
						break;
					case 6:
						uni.navigateTo({
							url:'./faultAssignment/faultAssignment'
						});
						break;
					case 7:
						uni.navigateTo({
							url:'./checkTick/completionRate'
						});
						break;
					case 8:
						uni.navigateTo({
							url:'./checkTick/exacutiveRate'
						});
						break;
					default:
						break;
				}
				
			},
			navigateToFun2(e){
				switch (e){
					case 1:
						$api.idSetter('qualityDefect','CA')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					case 2:
						$api.idSetter('qualityDefect','HTZJ')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					case 3:
						$api.idSetter('qualityDefect','MAZJ')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					case 4:
						$api.idSetter('qualityDefect','PAFP')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					case 5:
						$api.idSetter('qualityDefect','FMAZJ')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					case 6:
						$api.idSetter('qualityDefect','PAFX')
						uni.navigateTo({
							url:'./qualitydefects/dieCasting'
						});
						break;
					default:
						break;
				}
				
			},
			navigateToFun3(e){
				switch (e){
					case 1:
						$api.idSetter('inputOutputType','CA')
						uni.navigateTo({
							url:'./inputOutput/dieCastingOutput'
						});
						break;
					case 2:
						$api.idSetter('inputOutputType','CV')
						uni.navigateTo({
							url:'./inputOutput/dieCastingOutput'
						});
						break;
					case 3:
						$api.idSetter('inputOutputType','SN')
						uni.navigateTo({
							url:'./inputOutput/dieCastingOutput'
						});
						break;
					case 4:
						$api.idSetter('inputOutputType','MA')
						uni.navigateTo({
							url:'./inputOutput/dieCastingOutput'
						});
						break;
					case 5:
						$api.idSetter('inputOutputType','RPA')
						uni.navigateTo({
							url:'./inputOutput/dieCastingOutput'
						});
						break;
					default:
						break;
				}
				
			},
			navigateToFun4(e){
				switch (e){
					case 1:
						uni.navigateTo({
							url:'./workinProgress/totalInquiry'
						});
						break;
					default:
						break;
				}
				
			},
			
			navigateToFun5(e){
				switch (e){
					case 1:
						uni.navigateTo({
							url:'./statisticalChart/totalQuery'
						});
						break;
					case 2:
						uni.setStorageSync('params',{position:'left', type:'H', productSum:this.thermalProduct, productYield:this.thermalReachYield })
						uni.navigateTo({
							url:'../index/reportDetails'
						});
						break;
					case 3:
						uni.setStorageSync('params',{position:'right', type:'H', productSum:this.thermalProduct, productYield:this.thermalReachYield })
						uni.navigateTo({
							url:'../index/reportDetails'
						});
						break;
					case 4:
						uni.navigateTo({
							url:'./statisticalChart/moldOutput'
						});
						break;
// 					case 5:
// 						uni.navigateTo({
// 							url:'./statisticalChart/castingWaste'
// 						});
// 						break;
					case 5:
						uni.navigateTo({
							url:'./statisticalChart/xStatistics'
						});
						break;
					case 6:
					uni.setStorageSync('params',{position:'right', type:'M', productSum:this.machineProduct, productYield:this.machineReachYield })
						uni.navigateTo({
							url:'../index/reportDetails'
						});
						break;
					case 7:
						uni.setStorageSync('params',{position:'left', type:'M', productSum:this.machineProduct, productYield:this.machineReachYield })
						uni.navigateTo({
							url:'../index/reportDetails'
						});
						break;
					case 8:
						uni.setStorageSync('params',{position:'left', bar:3, productSum:this.machineProduct, productYield:this.machineReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 9:
						uni.setStorageSync('params',{position:'right',bar:3, productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 10:
						uni.setStorageSync('params',{position:'left',bar:1, productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 11:
						uni.setStorageSync('params',{position:'right',bar:1, productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 12:
						uni.setStorageSync('params',{position:'left',bar:2, productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 13:
						uni.setStorageSync('params',{position:'right',bar:2, productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'../index/paintingDetails'
						});
						break;
					case 14:
						uni.setStorageSync('params',{position:'right', productSum:this.coatingProduct, productYield:this.coatingReachYield })
						uni.navigateTo({
							url:'./statisticalChart/unqualified'
						});
						break;
					default:
						break;
				}
				
			}
			
		},
		computed:{
			inter(){
				return $inter.digital
			}
		}
	}
</script>

<style>
	.content {
		text-align: center;
	}
    
	.swiper {
		height: 332upx;
	}
	.swiper-item {
		display: block;
		width: 100%;
		height: 332upx;
		line-height: 332upx;
		text-align: center;
	}
	.bottom-view{
		width: 100%;
		padding-top: 20upx;
	}
	.bottom-view-top{
		height: 40upx;
		width: 100%;
		display: flex;
		align-items: center;
		margin-bottom: 20upx;
	}
	.bottom-view-top-view view{
		color: #2F2F2F;
		font-size: 14px;
		font-weight: 400;
		margin-left: 8upx;
	}
	
	.bottom-view-bottom{
		
	}
	.bottom-view-bot-v{
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		justify-content: flex-start;
		padding: 0px 5px 0px 5px;
	}
	
	.bottom-view-bot-v-view{
		height: 152upx;
		width: 224upx;
		margin-left: 18upx;
		background-color: #FFFFFF;
		margin-bottom: 16upx;
		box-shadow:0upx 0upx 4upx 0upx rgba(229,229,229,0.5);
		border-radius:8upx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.bottom-view-bot-v-view-1{
		height: 68upx;
		width: 224upx;
		margin-left: 18upx;
		background-color: #FFFFFF;
		margin-bottom: 16upx;
		box-shadow:0upx 0upx 4upx 0upx rgba(229,229,229,0.5);
		border-radius:8upx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
</style>
